package com.ly.share.juc.statistics;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author icanci
 * @since 1.0 Created in 2022/06/06 21:24
 */
public class AtomicLongDemo extends AbstractLockDemo {

    private static final AtomicLong ATOMIC_LONG = new AtomicLong(0);

    public static void main(String[] args) {
        AtomicLongDemo lockDemo = new AtomicLongDemo();
        Long sum = lockDemo.log(() -> {
            for (int i = 0; i < count; i++) {
                ATOMIC_LONG.incrementAndGet();
            }
            return ATOMIC_LONG.get();
        });
        System.out.println(sum);
    }
}
